﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manage/MasterPage.master" AutoEventWireup="true" CodeFile="EditPower.aspx.cs" Inherits="Manage_EditPower" %>
<%@ Register Src="~/Manage/CmsMessageBox.ascx" TagPrefix="cms" TagName="MessageBox" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        div#SearchBar
        {
            width: 900px;
            margin: 0px auto 10px auto;
            clear: both;
            text-align: right;
        }

        table.List tr
        {
            background-color: #ffffff;
        }
        
        table.List tr.hover
        {
            background-color: #ffeeaa;
        }
    </style>

    <script type="text/javascript">
        $(document).ready(function () {
            $('table.List > tbody > tr:gt(0)').mouseover(function () {
                $(this).addClass('hover');
            });
            $('table.List > tbody > tr:gt(0)').mouseout(function () {
                $(this).removeClass('hover');
            });

            $('#<%=Save.ClientID %>').click(function () {
                //获取用户所设置的权限
                var xml = '';
                $('input[name="power"]:checked').each(function (idx, o) {
                    var tid = o.id.substring(o.id.indexOf('_') + 1, o.id.lastIndexOf('_'));
                    xml += '&lt;power topicid="' + tid + '" value="' + o.value + '"/&gt;';
                });

                $('table#<%=OtherPowers.ClientID %>').children().children().children().children(':checked').each(function (idx, o) {
                    xml += '&lt;power value=\"' + o.value + '\"/&gt;';
                });

                xml = '&lt;powers mid="<%=Request.Params["uid"] %>"&gt;' + xml + '&lt;/powers&gt;';

                $('input#<%=ValueXML.ClientID %>').val(xml);

                return true;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server">
    <cms:MessageBox id="MessageBox" runat="server" />
        <div id="SearchBar">
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td><asp:Button ID="Save" runat="server" Text="保存" onclick="Save_Click"/></td>
                </tr>
            </table>
        </div>
        <div>
        <table class="List" cellspacing="1">
            <tr class="header">
                <th style="width:500px">栏目</th>
                <th style="width:400px">操作</th>
            </tr>

            <%=powerTable %>

            <tr>
                <td align="center" colspan="2">
                    <asp:CheckBoxList ID="OtherPowers" runat="server" RepeatDirection="Horizontal" RepeatColumns="3" BackColor="Transparent">
                        <asp:ListItem Text="系统管理员" Value="1"></asp:ListItem>
                        <asp:ListItem Text="录入教师信息" Value="8"></asp:ListItem>
                        <asp:ListItem Text="审核教师信息" Value="16"></asp:ListItem>
                    </asp:CheckBoxList>
                </td>
            </tr>
        </table>
    </div>
    <asp:HiddenField ID="ValueXML" runat="server" />
</asp:Content>

